home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d12 / cbibcode.arc / STRCMPI.C < prev    next >
Encoding:
C/C++ Source or Header  |  1991-08-05  |  635 b   |  29 lines

  1. /* strcmpi.c From TC Bible page 278  Use strcmpi to compare one string
  2. to another.  The comparision is not case sensitive. */
  3.  
  4. #include <stdio.h>
  5. #include <string.h>
  6. main()
  7. {
  8.     int result;
  9.     char str1[80], str2[80];
  10.     printf("Enter a string: ");
  11.     gets(str1);
  12.     printf("Enter a string to compare with first: ");
  13.     gets(str2);
  14.     printf("Case insensitive comparison shows that\n");
  15.     result = strcmpi(str1, str2);
  16.     if (result == 0)
  17.     {
  18.         printf("\"%s\" == \"%s\"\n", str1, str2);
  19.     }
  20.     if (result < 0)
  21.     {
  22.         printf("\"%s\" < \"%s\"\n", str1, str2);
  23.     }
  24.     if (result > 0)
  25.     {
  26.         printf("\"%s\" > \"%s\"\n", str1, str2);
  27.     }
  28. }
  29.